package lesson1.com.transportation;

public class Car extends Vehicle  {
    private String color;
    private boolean automatic;
    private int maxSpeed;
    
    public Car(){
        this("primer", false, 120);
        //System.out.println("A car is born");
    }
    
    public Car(String color, boolean automatic, int maxSpeed){
        super(Vehicle.LAND);
        this.color = color;
        this.automatic = automatic;
        this.maxSpeed = maxSpeed;
    }
    
    @Override
    public String getDetails(){
        StringBuilder sb = new StringBuilder();
        sb.append(super.getDetails());
        sb.append("Color: ");
        sb.append(color);
        sb.append(", Automatic?: ");
        sb.append(automatic);
        sb.append(", Max Speed: ");
        sb.append(maxSpeed);
        return sb.toString();
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public boolean isAutomatic() {
        return automatic;
    }

    public void setAutomatic(boolean automatic) {
        this.automatic = automatic;
    }

    public int getMaxSpeed() {
        return maxSpeed;
    }

    public void setMaxSpeed(int maxSpeed) {
        if(maxSpeed < 0){
            maxSpeed = 0;
        }
        this.maxSpeed = maxSpeed;
    }
}